<?php defined('InShopNC') or exit('Access Invalid!');?>
<!--商品分类-->
<script type="text/javascript">
    var SHOP_SITE_URL = "<?php echo SHOP_SITE_URL; ?>";
    var UPLOAD_SITE_URL = "<?php echo UPLOAD_SITE_URL; ?>";
    var important_goods_max = 2;
</script>
<style>
    .home-templates-board-layout .goods-list01 {
        width: 212px !important;
    }
    .home-templates-board-layout .goods-list01 li {
        width: 212px;
    }
    .home-templates-board-layout .goods-list01 span {
        width: 212px;
    }
    .home-templates-board-layout {
        background: none;
    }
    .home-templates-board-layout dd.g02 {
        height: 440px;
    }
    .home-templates-board-layout dd.category-list li a{
        height:130px;
        line-height: 130px;
    }
    .home-templates-board-layout dd.category-list li {
        width: 230px;
        border-left: solid 1px rgba(255,255,255,0.15);
        border-right: solid 1px rgba(0,0,0,0.14);
    }
</style>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <a class="back" href="index.php?act=web_config&op=new_web_config" title="返回<?php echo '板块区'; ?>列表"><i class="fa fa-arrow-circle-o-left"></i></a>
            <div class="subject">
                <h3><?php echo $lang['web_config_index']; ?> - <?php echo $lang['web_config_web_edit']; ?>
                    “<?php echo $output['web_array']['web_name'] ?>”板块</h3>
                <h5><?php echo $lang['nc_web_index_subhead']; ?></h5>
            </div>
        </div>
    </div>
    <!-- 操作说明 -->
    <div class="explanation" id="explanation">
        <div class="title" id="checkZoom"><i class="fa fa-lightbulb-o"></i>
            <h4 title="<?php echo $lang['nc_prompts_title'];?>"><?php echo $lang['nc_prompts'];?></h4>
            <span id="explanationZoom" title="<?php echo $lang['nc_prompts_span'];?>"></span> </div>
        <ul>
            <li><?php echo $lang['web_config_edit_help1'];?></li>
        </ul>
    </div>

    <div class="ncap-form-all">
        <dl class="row">
            <dt class="tit">
                <label><?php echo $lang['web_config_edit_html'].$lang['nc_colon'];?></label>
            </dt>
            <dd class="opt">
                <div class="middle home-templates-board-layout style-<?php echo $output['web_array']['style_name'];?>">
                    <div class="left">
                        <!--左边标题图片块-->
                        <dl id="left_tit">
                            <dt>
                                <h4><?php echo $lang['web_config_picture_tit'];?></h4>
                                <a href="JavaScript:show_dialog('upload_tit');"><i class="fa fa-pencil-square-o"></i><?php echo $lang['nc_edit'];?></a>
                            </dt>
                            <dd class="tit-txt" <?php if($output['code_tit']['code_info']['type'] != 'txt'){ ?>style="display:none;"<?php } ?>>
                                <div id="picture_floor" class="txt-type"> <span><?php echo $output['code_tit']['code_info']['floor'];?></span>
                                    <h2><?php echo $output['code_tit']['code_info']['title'];?></h2>
                                </div>
                            </dd>
                            <dd class="tit-pic" <?php if($output['code_tit']['code_info']['type'] == 'txt'){ ?>style="display:none;"<?php } ?>>
                                <div id="picture_tit" class="picture"> <img src="<?php echo UPLOAD_SITE_URL.'/'.$output['code_tit']['code_info']['pic'];?>"/> </div>
                            </dd>
                        </dl>
                        <!--左边商品块-->
<!--                        --><?php //if (is_array($output['code_recommend_list']['code_info']) && !empty($output['code_recommend_list']['code_info'])) { ?>
<!--                            --><?php //foreach ($output['code_recommend_list']['code_info'] as $key => $val) { ?>
                                <dl recommend_id="<?php echo 0;?>">
                                    <dt>
                                        <h4>商品</h4>
                                        <a href="JavaScript:show_recommend_dialog(<?php echo 0;?>);"><i class="fa fa-pencil-square-o"></i><?php echo $lang['nc_edit'];?></a>
<!--                                        <a href="JavaScript:del_recommend(--><?php //echo $key;?><!--);"><i class="fa fa-trash"></i>--><?php //echo $lang['nc_del'];?><!--</a>-->
                                    </dt>
                                    <dd>
                                        <?php if(!empty($output['code_recommend_list']['code_info'][0]['goods_list']) && is_array($output['code_recommend_list']['code_info'][0]['goods_list'])) { ?>
                                            <ul class="goods-list goods-list01">
                                                <?php foreach($output['code_recommend_list']['code_info'][0]['goods_list'] as $k => $v) { ?>
                                                    <li><span><a href="javascript:void(0);"> <img title="<?php echo $v['goods_name'];?>" src="<?php echo strpos($v['goods_pic'],'http')===0 ? $v['goods_pic']:UPLOAD_SITE_URL."/".$v['goods_pic'];?>"/></a></span> </li>
                                                <?php } ?>
                                            </ul>
                                        <?php } ?>

                                    </dd>
                                </dl>
<!--                            --><?php //} ?>
<!--                        --><?php //} ?>
                    </div>
                    <!--右边分类块-->
                    <div class="middle middle01">
                        <div>
                            <dl>
                                <dt>
                                    <h4>分类</h4>
                                    <a href="JavaScript:show_dialog('category_list');"><i class="icon-th"></i><?php echo $lang['nc_edit'];?></a></dt>
                                <dd class="category-list g02">
                                    <ul>
                                        <?php if (is_array($output['code_category_list']['code_info']['goods_class']) && !empty($output['code_category_list']['code_info']['goods_class'])) { ?>
                                            <?php foreach ($output['code_category_list']['code_info']['goods_class'] as $k => $v) { ?>
                                                <li title="<?php echo $v['gc_name'];?>"><a href="javascript:void(0);"><?php echo $v['gc_name'];?></a></li>
                                            <?php } ?>
                                        <?php } ?>
                                    </ul>
                                </dd>
                            </dl>
                        </div>
                    </div>
                </div>
            </dd>
        </dl>
    </div>
    <div class="ncap-form-default">
        <div class="bot">
            <a href="index.php?act=web_config&op=html_update&web_id=<?php echo $_GET['web_id'];?>" class="ncap-btn-big ncap-btn-green"><?php echo $lang['web_config_web_html']; ?></a>
        </div>
    </div>
</div>


<!-- 标题图片 -->
<div id="upload_tit_dialog" style="display:none;">
    <div class="s-tips"><i class="fa fa-lightbulb-o"></i><?php echo $lang['web_config_prompt_tit'];?></div>
    <form id="upload_tit_form" name="upload_tit_form" enctype="multipart/form-data" method="post" action="index.php?act=web_config&op=upload_pic" target="upload_pic">
        <input type="hidden" name="form_submit" value="ok" />
        <input type="hidden" name="web_id" value="<?php echo $output['code_tit']['web_id'];?>">
        <input type="hidden" name="code_id" value="<?php echo $output['code_tit']['code_id'];?>">
        <input type="hidden" name="tit[pic]" value="<?php echo $output['code_tit']['code_info']['pic'];?>">
        <input type="hidden" name="tit[url]" value="">
        <div class="ncap-form-default">
            <dl style="display:none;" class="row">
                <dt class="tit"><?php echo $lang['web_config_upload_type'].$lang['nc_colon'];?></dt>
                <dd class="opt">
                    <label title="<?php echo $lang['web_config_upload_pic'];?>">
                        <input type="radio" name="tit[type]" value="pic" onclick="upload_type('tit');" <?php if($output['code_tit']['code_info']['type'] != 'txt'){ ?>checked="checked"<?php } ?>>
                        <span><?php echo $lang['web_config_upload_pic'];?></span>
                    </label>
                    <label title="<?php echo '文字类型';?>">
                        <input type="radio" name="tit[type]" value="txt" onclick="upload_type('tit');" <?php if($output['code_tit']['code_info']['type'] == 'txt'){ ?>checked="checked"<?php } ?>>
                        <span><?php echo '文字类型';?></span>
                    </label>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl id="upload_tit_type_pic" class="row" <?php if($output['code_tit']['code_info']['type'] == 'txt'){ ?>style="display:none;"<?php } ?>>
                <dt class="tit"><?php echo $lang['web_config_upload_tit'].$lang['nc_colon'];?></dt>
                <dd class="opt">
                    <div class="input-file-show"> <span class="type-file-box">
            <input type='text' name='textfield' id='textfield1' class='type-file-text' />
            <input type='button' name='button' id='button1' value='选择上传...' class='type-file-button' />
            <input name="pic" id="pic" type="file" class="type-file-file" size="30">
            </span></div>
                    <p class="notic"><?php echo $lang['web_config_upload_tit_tips'];?></p>
                </dd>
            </dl>
            <div id="upload_tit_type_txt" <?php if($output['code_tit']['code_info']['type'] != 'txt'){ ?>style="display:none;"<?php } ?>>
                <dl class="row">
                    <dt class="tit"><?php echo '楼层编号';?></dt>
                    <dd class="opt">
                        <input class="input-txt" type="text" name="tit[floor]" id="tit_floor" value="<?php echo $output['code_tit']['code_info']['floor'];?>">
                        <p class="notic"><?php echo '如1F、2F、3F。';?></p>
                    </dd>
                </dl>
                <dl class="row">
                    <dt class="tit"><?php echo '版块标题';?></dt>
                    <dd class="opt">
                        <input class="input-txt" type="text" name="tit[title]" id="tit_title" value="<?php echo $output['code_tit']['code_info']['title'];?>">
                        <p class="notic"><?php echo '如鞋包配饰、男女服装、运动户外。';?></p>
                    </dd>
                </dl>
            </div>
            <div class="bot"><a href="JavaScript:void(0);" onclick="$('#upload_tit_form').submit();" class="ncap-btn-big ncap-btn-green"><?php echo $lang['nc_submit'];?></a></div>
        </div>
    </form>
</div>
<!-- 商品推荐模块 -->
<div id="recommend_list_dialog" style="display:none;">
    <div class="s-tips"><i></i>小提示：单击查询出的商品选中，双击已选择的可以删除，最多2个，保存后生效。</div>
    <form id="recommend_list_form">
        <input type="hidden" name="web_id" value="<?php echo $output['code_recommend_list']['web_id'];?>">
        <input type="hidden" name="code_id" value="<?php echo $output['code_recommend_list']['code_id'];?>">
        <div id="recommend_input_list" style="display:none;"><!-- 推荐拖动排序 --></div>
<!--        --><?php //if (is_array($output['code_recommend_list']['code_info']) && !empty($output['code_recommend_list']['code_info'])) { ?>
<!--            --><?php //foreach ($output['code_recommend_list']['code_info'] as $key => $val) { ?>
                <!--<div class="ncap-form-default" select_recommend_id="<?php /*echo $key;*/?>">
                    <dl class="row">
                        <dt class="tit"> <?php /*echo $lang['web_config_recommend_title'];*/?></dt>
                        <dd class="opt">
                            <input name="recommend_list[<?php /*echo $key;*/?>][recommend][name]" value="<?php /*echo $val['recommend']['name'];*/?>" type="text" class="input-txt">
                            <p class="notic"><?php /*echo $lang['web_config_recommend_tips'];*/?></p>
                        </dd>
                    </dl>
                </div>-->
                <div class="ncap-form-all" select_recommend_id="<?php echo 0;?>">
                    <dl class="row">
                        <dt class="tit">已选商品</dt>
                        <dd class="opt">
                            <ul class="dialog-goodslist-s1 goods-list">
                                <?php if(!empty($output['code_recommend_list']['code_info'][0]['goods_list']) && is_array($output['code_recommend_list']['code_info'][0]['goods_list'])) { ?>
                                    <?php foreach($output['code_recommend_list']['code_info'][0]['goods_list'] as $k => $v) { ?>
                                        <li id="select_recommend_<?php echo 0;?>_goods_<?php echo $k;?>">
                                            <div ondblclick="del_recommend_goods(<?php echo $v['goods_id'];?>);" class="goods-pic">
                                                <span class="ac-ico" onclick="del_recommend_goods(<?php echo $v['goods_id'];?>);"></span>
                                                <span class="thumb size-72x72"><i></i><img select_goods_id="<?php echo $v['goods_id'];?>" title="<?php echo $v['goods_name'];?>" goods_name="<?php echo $v['goods_name'];?>" src="<?php echo strpos($v['goods_pic'],'http')===0 ? $v['goods_pic']:UPLOAD_SITE_URL."/".$v['goods_pic'];?>" onload="javascript:DrawImage(this,72,72);" /></span>
                                            </div>
                                            <div class="goods-name"><a href="<?php echo SHOP_SITE_URL."/index.php?act=goods&goods_id=".$v['goods_id'];?>" target="_blank"><?php echo $v['goods_name'];?></a></div>
                                            <input name="recommend_list[<?php echo 0;?>][goods_list][<?php echo $v['goods_id'];?>][goods_id]" value="<?php echo $v['goods_id'];?>" type="hidden">
                                            <input name="recommend_list[<?php echo 0;?>][goods_list][<?php echo $v['goods_id'];?>][market_price]" value="<?php echo $v['market_price'];?>" type="hidden">
                                            <input name="recommend_list[<?php echo 0;?>][goods_list][<?php echo $v['goods_id'];?>][goods_name]" value="<?php echo $v['goods_name'];?>" type="hidden">
                                            <input name="recommend_list[<?php echo 0;?>][goods_list][<?php echo $v['goods_id'];?>][goods_price]" value="<?php echo $v['goods_price'];?>" type="hidden">
                                            <input name="recommend_list[<?php echo 0;?>][goods_list][<?php echo $v['goods_id'];?>][goods_pic]" value="<?php echo $v['goods_pic'];?>" type="hidden">
                                        </li>
                                    <?php } ?>
                                <?php } ?>

                            </ul>
                        </dd>
                    </dl>
                </div>
<!--            --><?php //} ?>
<!--        --><?php //} ?>
        <div id="add_recommend_list" style="display:none;"></div>
        <div class="ncap-form-all">
            <dl class="row">
                <dt class="tit">选择要展示的商品</dt>
                <dd class="opt">
                    <div class="search-bar">
                        <label id="recommend_gcategory">商品分类
                            <input type="hidden" id="cate_id" name="cate_id" value="0" class="mls_id" />
                            <input type="hidden" id="cate_name" name="cate_name" value="" class="mls_names" />
                            <select>
                                <option value="0"><?php echo $lang['nc_please_choose'];?></option>
                                <?php if(!empty($output['goods_class']) && is_array($output['goods_class'])) { ?>
                                    <?php foreach($output['goods_class'] as $k => $v) { ?>
                                        <option value="<?php echo $v['gc_id'];?>"><?php echo $v['gc_name'];?></option>
                                    <?php } ?>
                                <?php } ?>
                            </select>
                        </label>
                        <input type="text" value="" name="recommend_goods_name" id="recommend_goods_name" placeholder="输入商品名称或SKU编号" class="txt w150">
                        <a href="JavaScript:void(0);" onclick="get_recommend_goods();" class="ncap-btn"><?php echo $lang['nc_query'];?></a></div>
                    <div id="show_recommend_goods_list" class="show-recommend-goods-list"></div>
                </dd>
            </dl>
        </div>
        <div class="bot"><a href="JavaScript:void(0);" onclick="update_recommend();" class="ncap-btn-big ncap-btn-green"><span><?php echo $lang['web_config_save'];?></span></a></div>
    </form>
</div>
<!-- 推荐分类模块 -->
<div id="category_list_dialog" style="display:none;">
    <div class="s-tips"><i class="fa fa-lightbulb-o"></i><?php echo $lang['web_config_category_tips'];?>，最多可显示9个</div>
    <form id="category_list_form">
        <input type="hidden" name="web_id" value="<?php echo $output['code_category_list']['web_id'];?>">
        <input type="hidden" name="code_id" value="<?php echo $output['code_category_list']['code_id'];?>">
        <div class="ncap-form-all">
            <dl class="row">
                <dt class="tit">已选商品分类</dt>
                <dd class="opt">
                    <div class="category-list category-list-edit">
                        <ul>
                            <?php if (is_array($output['code_category_list']['code_info']['goods_class']) && !empty($output['code_category_list']['code_info']['goods_class'])) { ?>
                                <?php foreach($output['code_category_list']['code_info']['goods_class'] as $k => $v) { ?>
                                    <li gc_id="<?php echo $v['gc_id'];?>" gc_name="<?php echo $v['gc_name'];?>" title="<?php echo $v['gc_name'];?>" ondblclick="del_goods_class(<?php echo $v['gc_id'];?>);"><i onclick="del_goods_class(<?php echo $v['gc_id'];?>);"></i><?php echo $v['gc_name'];?>
                                        <input name="category_list[goods_class][<?php echo $v['gc_id'];?>][gc_id]" value="<?php echo $v['gc_id'];?>" type="hidden">
                                        <input name="category_list[goods_class][<?php echo $v['gc_id'];?>][gc_name]" value="<?php echo $v['gc_name'];?>" type="hidden">
                                    </li>
                                <?php } ?>
                            <?php } ?>
                        </ul>
                    </div>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit"><?php echo $lang['web_config_category_title'];?></dt>
                <dd class="opt"><div class="search-bar">商品分类：
                        <select name="gc_parent_id" id="gc_parent_id" onchange="get_goods_class();">
                            <option value="0"><?php echo $lang['nc_please_choose'];?></option>
                            <?php if(!empty($output['parent_goods_class']) && is_array($output['parent_goods_class'])) { ?>
                                <?php foreach($output['parent_goods_class'] as $k => $v) { ?>
                                    <option value="<?php echo $v['gc_id'];?>"><?php echo $v['gc_name'];?></option>
                                <?php } ?>
                            <?php } ?>
                        </select></div>
                    <p class="notic"><?php echo $lang['web_config_category_note'];?></p>
                </dd>
            </dl>
        </div>
        <div class="bot"><a href="JavaScript:void(0);" onclick="update_category();" class="ncap-btn-big ncap-btn-green"><?php echo $lang['web_config_save'];?></a></div>
    </form>
</div>
<iframe style="display:none;" src="" name="upload_pic"></iframe>
<script src="<?php echo ADMIN_RESOURCE_URL;?>/js/jquery.ajaxContent.pack.js"></script>
<script src="<?php echo RESOURCE_SITE_URL;?>/js/common_select.js"></script>
<script src="<?php echo RESOURCE_SITE_URL;?>/js/waypoints.js"></script>
<script src="<?php echo ADMIN_RESOURCE_URL?>/js/web_index_fl.js"></script>
